package com.ty.day4;

import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/9 18:25
 */
public class Task3 {
    public static void main(String[] args) {
        int year,month,flag=0;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年份和月份：");
        year=sc.nextInt();
        month=sc.nextInt();
        if (year%4==0&&year%100!=0||year%400==0){
            flag=1;
        }
        if (month<1||month>12){
            System.out.println("月份不合要求");
            return;
        }
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                System.out.println(year+"年"+month+"月有31天");
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                System.out.println(year+"年"+month+"月有30天");
                break;
            case 2:
                if (flag==1){
                    System.out.println(year+"年"+month+"月有29天");
                    break;
                }
                System.out.println(year+"年"+month+"月有28天");
        }
    }
}
